<?php
	// these are include_once() instead of require_once() because the extra fill
	// in utility needs to require this file without errors, and the paths are
	// never going to be correct
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/pd_character.php");

	class Alert {
		private $date;
		private $cluster;
		private $sector;
		private $coords;
		private $reason;
		private $offender;
		private $name;
		private $type;
		private $logID;
		private $cleared;
                private $superceded;

		public function __construct($date, $cluster, $sector, $coords, $reason, $offender, $name, $type, $logID = 0, $cleared = 0, $superceded = 0) {
			$this->date = $date;
			$this->cluster = $cluster;
			$this->sector = $sector;
			$this->coords = $coords;
			$this->reason = $reason;
			$this->offender = $offender;
			$this->name = $name;
			$this->type= $type;
			$this->logID= $logID;
			$this->cleared= $cleared;
                        $this->superceded= $superceded;
		}

		public function getDate(){
			return $this->date;
		}
		
		public function getCluster(){
			return $this->cluster;
		}
		
		public function getSector(){
			return $this->sector;
		}
		
		public function getCoords(){
			return $this->coords;
		}
		
		public function getReason(){
			return $this->reason;
		}
		
		public function getOffender(){
			return $this->offender;
		}

		public function getName() {
			return $this->name;
		}

		public function drawName() {
			$char = new PD_Character($_SESSION["account"]->getUniverse(), $this->name);
			$char->drawName();
		}

		public function getType() {
			return $this->type;
		}
		
		public function getLogID() {
			return $this->logID;
		}
		
		public function getCleared() {
			return $this->cleared;
		}
                
                public function getSuperceded(){
                    return $this->superceded;
                }
		
		public static function cmp_obj($a, $b){
			$a1 = strtotime($a->date);
			$b1 = strtotime($b->date);
			if ($a1 == $b1){
				return 0;
			}
			return ($a1 > $b1) ? +1 : -1;
		}

	}
	
	class ManualAlert {
		private $alerterID;
		private $alertType;
		private $sector;
		private $coords;
		private $header;
		private $detail;
		private $date;
		
		public function __construct($alerterID, $alertType, $sector, $coords, $header, $detail, $date = "") {
			$this->alerterID = $alerterID;
			$this->alertType = $alertType;
			$this->sector = $sector;
			$this->coords = $coords;
			$this->header = $header;
			$this->detail = $detail;
			$this->date = $date;
		}
		
		public function getAlerterID() {
			return $this->alerterID;
		}
		
		public function getAlertType() {
			return $this->alertType;
		}
		
		public function getSector() {
			return $this->sector;
		}
		
		public function getCoords() {
			return $this->coords;
		}
		
		public function getHeader() {
			return $this->header;
		}
		
		public function getDetail() {
			return $this->detail;
		}
	}
	
	class SightingAlert {
		private $sighterID;
		private $sector;
		private $coords;
		private $pilotName;
		
		public function __construct($sighterID, $sector, $coords, $pilotName) {
			$this->sighterID= $sighterID;
			$this->sector= $sector;
			$this->coords= $coords;
			$this->pilotName= $pilotName;
		}
		
		public function getSighterID(){
			return $this->sighterID;
		}
		
		public function getSector(){
			return $this->sector;
		}
		
		public function getCoords(){
			return $this->coords;
		}
		
		public function getPilotName(){
			return $this->pilotName;
		}
                
	}
	
	class ManualAlertType {
		private $id;
		private $type;
		
		public function __construct($id, $type) {
			$this->id = $id;
			$this->type = $type;
		}
		
		public function getId () {
			return $this->id;
		}
		
		public function getType() {
			return $this->type;
		}
	}
        
        class SafeTile {
            private $alerterId;
            private $sector;
            private $coords;
            private $comment;
            private $date;
            
            public function __construct($alerterId, $sector, $coords, $comment, $date = "") {
                $this->alerterId = $alerterId;
                $this->sector = $sector;
                $this->coords = $coords;
                $this->comment = $comment;
                $this->date = $date;
            }
            
            public function getAlerterId() {
                return $this->alerterId;
            }
            
            public function getSector() {
                return $this->sector;
            }
            
            public function getCoords() {
                return $this->coords;
            }
            
            public function getComment() {
                return $this->comment;
            }
            
            public function getDate() {
                return $this->date;
            }
        }
?>